package com.wdj.library.controller;

import ch.qos.logback.core.util.FileUtil;
import com.wdj.library.entity.BookInfo;
import com.wdj.library.entity.vo.Result;
import com.wdj.library.inter.JwtToken;
import com.wdj.library.service.BookInfoService;
import org.apache.tomcat.util.http.fileupload.FileUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;


/**
 * 书籍(BookInfo)表控制层
 *
 * @author wdj
 * @since 2020-08-12 11:54:02
 */
@RestController
@RequestMapping("bookInfo")
public class BookInfoController {
    /**
     * 服务对象
     */
    @Resource
    private BookInfoService bookInfoService;


    /**
     * @Author wdj
     * @Description //TODO 查询全部
     * @Date 10:26 2020/8/14
     * @Param [offset, limit]
     * @return com.wdj.library.entity.vo.Result
     **/
    @JwtToken
    @GetMapping("selectAll")
    public Result selectAll(int offset, int limit){
        return bookInfoService.queryAllByLimit(offset,limit);
    }


    /**
     * @Author wdj
     * @Description //TODO 模糊查询
     * @Date 10:41 2020/8/14
     * @Param [name]
     * @return com.wdj.library.entity.vo.Result
     **/
    @JwtToken
    @GetMapping("selectByBookName")
    public Result selectByBookName(String name){
        return bookInfoService.queryByBookName(name);
    }

}